/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ticketmaster.businessobject;

import java.util.ArrayList;
import java.util.Collection;

/**
 *
 * @author Wei Liu
 */
public class ShoppingCart
{
    private Collection<Ticket> tickets;

    public ShoppingCart()
    {
        tickets = new ArrayList<Ticket>();
    }

    public void add(Ticket ticket)
    {
        if(!this.tickets.contains(ticket))
            this.tickets.add(ticket);
    }

    public void clear()
    {
        this.tickets.clear();
    }

    public int size()
    {
        return this.tickets.size();
    }

    /**
     * @return the tickets
     */
    public Collection<Ticket> getTickets()
    {
        return tickets;
    }

    /**
     * @param tickets the tickets to set
     */
    public void setTickets(Collection<Ticket> tickets)
    {
        this.tickets = tickets;
    }

    public void remove(Ticket ticket)
    {
        if(tickets.contains(ticket))
        {
            tickets.remove(ticket);
        }
    }
}
